package com.lkx.webservice;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import javax.jws.WebService;

import org.springframework.stereotype.Component;

@WebService(serviceName = "UserService", // 与接口中指定的name一致
targetNamespace="http://webservice.lkx.com", // 与接口中的命名空间一致,一般是接口的包名倒
endpointInterface = "com.lkx.webservice.UserService"// 接口地址
)
@Component
public class UserServiceImpl implements UserService {
	
	private static Map<Long, User> userMap = new HashMap<Long, User>();
	
	static{
		User user = new User();
		user.setUserId(10001L);
		user.setUsername("likaixuan");
		user.setEmail("likaixuan@qq.com");
		user.setGmtCreate(new Date());
		userMap.put(user.getUserId(), user);
		
		user = new User();
		user.setUserId(10002L);
		user.setUsername("xiaohong");
		user.setEmail("xiaohong@qq.com");
		user.setGmtCreate(new Date());
		userMap.put(user.getUserId(), user);
		
		user = new User();
		user.setUserId(10003L);
		user.setUsername("xiaoming");
		user.setEmail("xiaoming@qq.com");
		user.setGmtCreate(new Date());
		userMap.put(user.getUserId(), user);
	}

	@Override
	public String getName(Long userId) {
		return "hello-" + userId;
	}

	@Override
	public User getUser(Long userId) {
		return userMap.get(userId);
	}

	

}
